Audio dynamic compression is an important procedure in which a large dynamic range of audio signals is compressed to better match the reduced dynamic range in impaired auditory systems. The compression can be implemented as a digital automatic gain control (AGC) that follows various rules for acceptable sound quality. In practice, these rules are expressed in functions (most likely piece-wise linear functions) that dictate the relationship between the peak (or rms) level of the input audio signals and the gain value.
What is needed is a measure of the peak level of the input signal, a compression function employed to evaluate the gain based on the peak level, and a multiplier to adjust channel gain in real time. The considerations of selecting an appropriate peak detector are usually specified by the requirements on attack time and release time. The attack (release) time may be defined as the time needed for the AGC to respond to a sudden 25-dB increase (decrease) of the input signal until the output signal is within 2 dB of the final signal level. Typically, the attack time is in the range of 0 to 10 ms, whereas the release time could be 10–100 times as large. The actual requirements of the attack or release time are usually application-dependent.